package com.notary.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.notary.entity.ScheduleJobLog;
import com.notary.entity.vo.JsonResult;
import com.notary.service.ScheduleJobLogService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 定时任务日志
 *
 * @author Mark sunlightcs@gmail.com
 */

@Api(tags = "定时任务日志控制器")
@RestController
@RequestMapping("/sys/scheduleLog")
public class ScheduleJobLogController {

	private ScheduleJobLogService scheduleJobLogService;

	@Autowired
	public ScheduleJobLogController(ScheduleJobLogService scheduleJobLogService){
		this.scheduleJobLogService = scheduleJobLogService;
	}
	/**
	 * 定时任务日志列表
	 */
	@PostMapping("/list")
	//     @PreAuthorize("hasAnyAuthority(''sys:schedule:log')")
	public JsonResult list(@RequestParam Map<String, Object> params){
		IPage<ScheduleJobLog> page = scheduleJobLogService.queryPage(params);
		return JsonResult.success(page);
	}
	
	/**
	 * 定时任务日志信息
	 */
	@GetMapping("/info/{logId}")
	public JsonResult info(@PathVariable("logId") Long logId){
		ScheduleJobLog log = scheduleJobLogService.getById(logId);
		return JsonResult.success(log);
	}
}
